package com.itheima;

import com.itheima.dao.UserDao;
import com.itheima.pojo.User;
import com.itheima.service.ProductService;
import com.itheima.service.UserService;
import com.itheima.xyz.X;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author huyoufu <https://github.com/huyoufu>
 * @TIME 2020-08-06 09:20
 * @description
 */
public class Test01 {
    public static void main(String[] args) {
        //创建一个spring的容器对象

        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");


       //试试xyz包下 x对象
        X x = context.getBean(X.class);
        System.out.println("获取xyz包下x对象:"+x);

        //获取service
        UserService userService = context.getBean(UserService.class);
        System.out.println("获取userService:"+userService);

        //获取dao

        UserDao userDao = context.getBean(UserDao.class);
        System.out.println("获取userDao:"+userDao);




    }
}
